#pragma once

namespace AVUI {

struct RoutedEventHandlerInfo
{
    RoutedEventHandlerInfo() { }
    RoutedEventHandlerInfo(Delegate* pHandler, bool handledEventsToo) : m_pHandler(pHandler), m_handledEventsToo(handledEventsToo) { }

    Delegate* get_Handler() { return m_pHandler; }
    bool get_InvokeHandledEventsToo() { return m_handledEventsToo; }

    void InvokeHandler(Object* pTarget, RoutedEventArgs* pRoutedEventArgs)
    {
        if (!pRoutedEventArgs->get_IsHandled() || m_handledEventsToo)
        {
            m_pHandler->Invoke(pTarget, pRoutedEventArgs);
            // Deviation, slightly different implementation.
        }
    }

private:
    TRefCountedPtr<Delegate> m_pHandler;
    bool m_handledEventsToo;
};

}; // namespace AVUI

